Ensure that _bindgen_ty_1 names ERR_LIB newtypes #373
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
We tell bindgen to generate newtypes for enums:
boring/boring-sys/build/main.rs
Line 748 in 0ca11b5
but Boring uses an anonymous
enumforERR_LIB_*constants:https://github.com/google/boringssl/blob/5622da92e1e7bacb5d0785ff5650a5a23b143b84/include/openssl/err.h#L223-L224
so bindgen picks
_bindgen_ty_1. I wanted to use the newtypes in an API, but referring to the type as_bindgen_ty_1is fragile, because it could break if boringssl adds any other anonymous type, or bindgen finds one in system headers.There's a bit of hacky parsing to find the actual type name of
ERR_LIB_SSL's newtype (bindgen doesn't expose AST or anything like that). The newtype ispub used under a future-proofErrLibname.